package com.hue.springbooteasyexcel.controller;

import com.hue.springbooteasyexcel.service.CourtsService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;
import org.springframework.web.multipart.MultipartFile;

import java.io.IOException;

/**
 * @author 姚凤桥
 * @Date 2022/1/18 9:06
 * @Description:
 */
@Controller
@RequestMapping("/courts")
public class CourtsController {
    @Autowired
    private CourtsService courtsService;

    @ResponseBody
    @PostMapping("/import")
    public String importCourts(MultipartFile file) throws IOException {
        courtsService.importUser(file);
        return "导入成功";
    }
}
